package cn.edu.scujcc.myprojecttest;

import cn.edu.scujcc.InterFace.LibraryApi;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class NetworkFactory {
    private static LibraryApi libraryApi;
    private static Retrofit retrofit;

//    private static YktApi yktApi;


    //创建retrofit实例
    static {
        retrofit = new Retrofit.Builder()
                //设置网络请求BaseUrl地址
                .baseUrl("http://1.116.134.119/")//这里是服务器的IP地址，域名映射需要ICN备案，更没有SSL证书
                //设置数据解析器
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    //图书馆登录
    public static LibraryApi LibraryApi(){
        if (null == libraryApi){
            libraryApi = retrofit.create(LibraryApi.class);
        }
        return libraryApi;
    }

//    //一卡通登录
//    public static YktApi YktApi(){
//        if (null == yktApi){
//            yktApi = retrofit.create(YktApi.class);
//        }
//        return yktApi;
//
//    }
}
